package com.hoshiicloud.lessee.feign.hystrix;

import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.lessee.feign.AuthFeignService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@Component
@Slf4j
public class HystrixAuthFeignFallback implements FallbackFactory<AuthFeignService> {

    @Override
    public AuthFeignService create(Throwable throwable) {
        log.error("fallback; reason was:"+throwable.toString());
        return new AuthFeignService() {
            @Override
            public Response lesseeLogin(String userName, String password, String userType, String privateDomain) {
                return Response.failed("登录服务失败");
            }



            @Override
            public Response logout2(@RequestBody String key) {
                return null;
            }
        };
    }
}
